package com.uenpay.im.ui.old.activity.movement;

import com.uenpay.im.configuration.APIConfiguration;
import com.uenpay.im.entities.HttpInvokeResult;
import com.uenpay.im.invokeitems.BaseHttpInvokeItem;

import org.json.JSONException;
import org.json.JSONObject;


public class AcceptMovementMemeberInvokeItem extends BaseHttpInvokeItem {
	public class AcceptMovementMemeberInvokeItemResult extends HttpInvokeResult {
	}

	public AcceptMovementMemeberInvokeItemResult getOutput() {
		return (AcceptMovementMemeberInvokeItemResult) GetResultObject();
	}

	/**
	 * 
	 * @param noticeid
	 * @param pop
	 *            0:cancel 1:praise
	 */
	public AcceptMovementMemeberInvokeItem(String noticeid, int pop) {
		String url = APIConfiguration.getBaseUrl()
				+ "Activity/Activity/aceptActivityMember?noticeid=" + noticeid
				+ "&accept=1&" + APIConfiguration.getCustIdAndToken();
		SetUrl(url);
	}

	@Override
	protected Object DeserializeResult(String responseBody) {
		AcceptMovementMemeberInvokeItemResult result = new AcceptMovementMemeberInvokeItemResult();
		JSONObject json = null;
		try {
			json = new JSONObject(responseBody);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		if (json == null) {
			return null;
		}
		result.status = json.optInt("status");
		result.msg = json.optString("msg");
		if (result.status != 0) {
			return result;
		}
		return result;
	}
}
